<?php
namespace app\servercertificate\validate;
use \app\manage\validate\BaseValidate;

class Certificate extends BaseValidate
{
    
	protected $rule =   [
        'id' => ['integer','gt'=>0],
        'certificate_id' => ['integer','gt'=>0],
        'user_id'  => ['integer','gt'=>0],
        'goods_id'  => ['integer','gt'=>0],
        'goods_ids'  => ['array','min'=>1],
		'goods_info'  => ['array','min'=>5],
        'page'=>['integer','gt'=>0],
        'listRows'=>['integer','gt'=>0,'elt'=>50],
        'title'=>['length'=>'2,50'],
        'product_code'=>['min'=>10],
        'cate_name'=>['length'=>'2,30'],
        'standart'=>['min'=>'2'],
        'desc'=>['min'=>'2'],
        'name'=>['length'=>'2,25'],
        'status'=>['in'=>'1,2'],
        'is_pick'=>['in'=>'0,1,2'],
        'is_transfer'=>['in'=>'0,1'],
        'is_sell'=>['in'=>'0,1'],
        'type'=>['in'=>['all','advanced','common']],
        'system_user_id' =>['integer', 'gt'=>0],
        'distribute_date' => ['dateFormat'=>'Y-m-d'],
        'certificate_ids' => ['regex' => '^\d+(,\d+)*$'],
        'to_user_names' => ['regex' => '^\w+(,\w+)*$'],
        'is_use_distribute' => ['in'=>'0,1'],
        'authors'=>['length'=>'0,30'],
        'profile_pic'=>['min'=>1],
        'price'=>['integer','gt'=>0],
        'sell_price'=>['integer','egt'=>0],
        'app_id'=>['integer', 'gt'=>0],
        'other_app_read'=>['length'=>'0,100'],
        'is_public'=>['in'=>'0,1'],
        'price_start' => ['integer','egt'=>0],
        'price_end' => ['integer','egt'=>0],
        'symbol' => ['in'=>'elt,between,egt'],
        'pay_method' => ['in'=>'cash,currency,alipay,wechat,unionpay'],
        'neq_distribute_time' => ['dateFormat'=>'Y-m-d'],
        'order' => ['in'=>'sell_price,pay_time'],
        'price_order' => ['in'=>'asc,desc'],
        'unit' => ['in'=>'5m,15m,30m,1h,6h,1d'],
        'scope' => ['in'=>'1h,2h,6h,12h,1d,1w,all'],
        'to_user_names' => ['min'=>2]
        
    ];

    protected $message  =   [
        'id' => '没有要选择的元素',
        'user_id' => '用户user_id为大于0的整数',
        'goods_id' => '商品goods_id为大于0的整数',
        'user_info' => '请传入用户信息',
        'goods_info' => '请传入商品信息[title],[product_code],[cate_name],[standart],[desc]',
        'page' => '当前页为大于0的整数',
        'listRows' => '每页显示的条数范围为1-50',
        'title' => '艺术品信息中的标题为2-50个字符',
        'cate_name' => '艺术品信息中的材质为2-30个字符',
        'standart' => '请传入艺术品信息中的规格信息',
        'desc' => '请传入艺术品信息中的描述信息',
        'status' => '1 为审核成功 2 为审核失败',
        'type' => 'all 全部证书 advanced 高级证书 common 普通证书',
    ];

    protected $scene = [
        'checkId' => ['id'],
        'checkIds' => ['id' => ['array','min'=>1 ] ],
        /*生成证书时检验艺术品信息*/
        'checkGoodsInfo' => [
            'title'=>['require','length'=>'2,50'],
            'product_code'=>['require','min'=>10],
            'cate_name'=>['require','length'=>'2,30'],
            'desc'=>['require','min'=>'2'],
            'authors'=>['length'=>'0,30'],
            'profile_pic'=>['require','min'=>1],
            'price'=>['require','integer','gt'=>0],
            'app_id'=>['require','integer', 'gt'=>0],
            'other_app_read'=>['require','length'=>'0,100'],
            'is_public'=>['require','in'=>'0,1'],
        ],
        'searchFields' => [
            'type' => ['in'=>['advanced','common']],
            'is_pick','is_transfer',
            'status'=>['in'=>'0,1,2,3'],
            'price_start','price_end','symbol','is_use_distribute',
        ],
        'userSearchFields' => [
            'user_id' => ['require','gt'=>0],
            'type' => ['in'=>['advanced','common']],
            'is_pick','is_transfer',
            'status'=>['in'=>'0,1,2'],
        ],
        'certificateInfo' => [
            'id' => ['require','integer','gt'=>0],
            'status' => ['array', 'min'=>1],
            'user_id'
        ],
        'getStatusByGoodsId' => ['goods_ids'],
        'getDistributePageList' => ['distribute_date','status'=>['in'=>'0,1'],'certificate_id','page','listRows'],
        'setMyCertificate' => [
            'user_id' => ['require','integer','gt'=>0],
            'id' => ['require','integer','gt'=>0],
            'is_sell', 'sell_price', 'to_user_names'
        ]
    ];

}